package binary;
/** 补码
 * complement 补充
 * */
public class ComplementDemo {
    public static void main(String[] args) {
        /*int max = Integer.MAX_VALUE;
        int min = Integer.MIN_VALUE;
        System.out.println(Integer.toBinaryString(min));//10000000000000000000000000000000
        System.out.println(Integer.toBinaryString(max));//1111111111111111111111111111111
        System.out.println(Integer.toBinaryString(-1));//11111111111111111111111111111111
        System.out.println(Integer.toBinaryString(0));//0
        int n = -45;
        System.out.println(Integer.toBinaryString(n));
        System.out.println(-45);*/
        int max = Integer.MAX_VALUE;
        int min = Integer.MIN_VALUE;
        System.out.println(Integer.toBinaryString(max));//1111111111---31个1
        System.out.println(Integer.toBinaryString(min));//1000000000---1后31个0
        System.out.println(Integer.toBinaryString(-1));//111---32个1
        System.out.println(Integer.toBinaryString(0));//000----32个0
        System.out.println(Integer.toBinaryString(-99));//很多11111
    }
}
